/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.sgsmcan.Entidad;

import java.io.Serializable;
import javax.persistence.Embeddable;
import javax.persistence.ManyToOne;

/**
 *
 * @author GOMEZ
 */
@Embeddable
public class SerenoPerroId implements Serializable {

    private Sereno sereno;
    private Perro perro;

    public SerenoPerroId() {
    }

    public SerenoPerroId(Sereno sereno, Perro perro) {
        this.sereno = sereno;
        this.perro = perro;
    }

    @ManyToOne
    public Sereno getSereno() {
        return sereno;
    }

    public void setSereno(Sereno sereno) {
        this.sereno = sereno;
    }

    @ManyToOne
    public Perro getPerro() {
        return perro;
    }

    public void setPerro(Perro perro) {
        this.perro = perro;
    }

    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }

        SerenoPerroId that = (SerenoPerroId) o;

        if (sereno != null ? !sereno.equals(that.sereno) : that.sereno != null) {
            return false;
        }
        if (perro != null ? !perro.equals(that.perro) : that.perro != null) {
            return false;
        }

        return true;
    }

    public int hashCode() {
        int result;
        result = (sereno != null ? sereno.hashCode() : 0);
        result = 31 * result + (perro != null ? perro.hashCode() : 0);
        return result;
    }
}
